import { defineStore } from 'pinia';
import { ref } from 'vue';
// token持久化
export const useUserStore = defineStore(
  'user',
  () => {
    const profile = ref({});
    const setProfile = (userinfo) => {
      profile.value = userinfo;
    };
    return { profile, setProfile };
  },
  {
    persist: {
      storage: {
        getItem(key) {
          return uni.getStorageSync(key);
        },
        setItem(key, val) {
          uni.setStorageSync(key, val);
        }
      }
    }
  }
);
